package com.example.kt_base.s6

//TODO 101.Kotlin语言的接口的定义

//1.接口里面的所有成员和接口本身都是public open 的
//2.接口不能有主构造
//3.实现类不仅仅要重写接口的函数，也要重写接口的成员
interface Iusb{
    var usbVersionInfo:String
    var usbInserDevice:String

    fun insertUsb():String
}

class Mouse: Iusb {
    override var usbInserDevice: String="鼠标接入了usb3.0"
        get() = field
        set(value) {
            field=value
        }
    override var usbVersionInfo: String="usb3.0"
        get() = field
        set(value) {
            field=  value
        }
    override fun insertUsb(): String {
        return "Mouse:$usbVersionInfo $usbInserDevice"
    }

}

class Keyboard(override var usbVersionInfo: String, override var usbInserDevice: String) : Iusb {
    override fun insertUsb(): String {
        return "Mouse:$usbVersionInfo $usbInserDevice"
    }

}
fun main() {
    val m= Mouse()
    m.usbVersionInfo="aaa"
    m.usbInserDevice="cccc"
    println(m.insertUsb())


    val k= Keyboard("ddd","ffff")
    println(k.insertUsb())


}
